package com.redisdemo.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.redisdemo.domain.CmsTask;
import com.redisdemo.mapper.CmsTaskMapper;
import com.redisdemo.service.CmsTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <h3>redisDemo</h3>
 * <p>任务表实现类</p>
 *
 * @author gdw
 * @since 2024-06-28 14:41:18
 */
@Service
public class CmsTaskServiceImpl extends ServiceImpl<CmsTaskMapper, CmsTask> implements CmsTaskService {
    @Autowired
    private CmsTaskMapper cmsTaskMapper;
    /**
     * 分页查询
     * @param params
     * @return
     */
    @Override
    public Page<CmsTask> selectPage(Map<String, Object> params) {
        Integer index = Integer.valueOf(params.get("index").toString()) ;
        Integer fo = Integer.valueOf( params.get("fo").toString());
        Page<CmsTask> page = new Page<>(index,fo);
        Page<CmsTask> cmsTaskPage = cmsTaskMapper.selectPage(page, null);
        //将数据存入到redis的hash类型中
        return cmsTaskPage;
    }
}
